package com.cqapp.widget.ui.search;

import androidx.fragment.app.Fragment;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.cqapp.widget.R;
import com.cqapp.widget.ui.image.ImageFragment;
import com.cqapp.widget.ui.image.ImageViewModel;

import java.util.ArrayList;
import java.util.List;

//存着数据
public class SearchViewModel  extends ViewModel {
    //存放 imagefragment
    List<Fragment> mfragmentList = new ArrayList<>();

    public SearchViewModel(List<Fragment> mfragmentList) {
        this.mfragmentList = mfragmentList;
    }

    public List<Fragment> getfragmentList() {
        return mfragmentList;
    }

    public SearchViewModel() {

        ImageViewModel imageViewModel = new ImageViewModel(R.drawable.a);
        ImageViewModel imageViewModel2 = new ImageViewModel(R.drawable.b);
        ImageViewModel imageViewModel3 = new ImageViewModel(R.drawable.c);

        mfragmentList.add(new ImageFragment(imageViewModel));
        mfragmentList.add(new ImageFragment(imageViewModel2));
        mfragmentList.add(new ImageFragment(imageViewModel3));
    }
}
